import {
	request,
	hotelRequest,
	otherRequest
} from '@/sheep/request';

export default {


	trip_order: (params) => request({
		url: '/trip/api/order',
		method: 'GET',
		params,
	}),


	taxiPrepay: (data) => request({
		url: '/trip/api/order/pre',
		method: 'POST',
		data,
	}),

	taxiCreateorder: (data) => request({
		url: '/trip/api/order/create',
		method: 'POST',
		data,
	}),

	sequn: (data) =>
		request({
			url: '/hotel/api/find_new/addFind',
			method: 'POST',
			data,
		}),

	// 订单详情
	detail: (id) =>
		otherRequest({
			url: 'order/order/' + id,
			method: 'GET',
		}),
	detail_zwy: (id) =>
		request({
			url: 'zowoyoo/order/' + id,
			method: 'GET',
		}),


	// 发票详情
	invoice: (id) =>
		otherRequest({
			url: 'order/invoice/' + id,
			method: 'GET',
		}),


	// 获取支付结果
	payResult: (id) =>
		otherRequest({
			url: 'order/order/' + id,
			method: 'GET',
			custom: {
				showLoading: false,
			},
		}),

	payResult_zyw: (id) =>
		request({
			url: 'zowoyoo/order/' + id,
			method: 'GET',
			custom: {
				showLoading: false,
			},
		}),

	itemDetail: (id, itemId) =>
		otherRequest({
			url: 'order/order/itemDetail/' + id + '/' + itemId,
			method: 'GET',
			custom: {
				showLoading: false,
			},
		}),

	// 订单列表
	list: (params) =>
		otherRequest({
			url: 'order/order',
			method: 'GET',
			params,
			custom: {
				showLoading: false,
			},
		}),

	list_zyw: (params) =>
		request({
			url: 'zowoyoo/order',
			method: 'GET',
			params,
			custom: {
				showLoading: false,
			},
		}),
	// 计算订单信息
	calc: (data) =>
		otherRequest({
			url: 'order/order/calc',
			method: 'POST',
			data,
		}),
	// 创建订单
	create: (data) =>
		otherRequest({
			url: 'order/order/create',
			method: 'POST',
			data,
		}),
	// 1688 计算运费
	freight1688: (data) =>
			otherRequest({
				url: 'order/tripartiteorder/yl_order',
				method: 'POST',
				data,
			}),
	// 下单
	create_order_zwy: (data) =>
		request({
			url: `zowoyoo/order/create`,
			method: 'POST',
			data: {
				...data
			}
		}),


	//订单可用优惠券
	coupons: (data) =>
		otherRequest({
			url: 'order/order/coupons',
			method: 'POST',
			data,
		}),

	// coupons: (params) =>
	// 	request({
	// 		url: '/shop/api/hotel/order/getCoupon',
	// 		method: 'GET',
	// 		params
	// 	}),

	// 确认收货
	confirm: (id) =>
		otherRequest({
			url: 'order/order/confirm/' + id,
			method: 'PUT',
		}),
	// 评价订单
	comment: (id, data) =>
		otherRequest({
			url: 'order/order/comment/' + id,
			method: 'POST',
			data,
		}),
	// 申请退款
	applyRefund: (id) =>
		otherRequest({
			url: 'order/order/applyRefund/' + id,
			method: 'PUT',
		}),
	// 取消订单
	cancel: (id) =>
		otherRequest({
			url: 'order/order/cancel/' + id,
			method: 'PUT',
		}),

			// 取消订单
	cancel_zwy: (id) =>
		request({
			url: 'zowoyoo/order/cancel/' + id,
			method: 'PUT',
		}),


	// 删除订单
	delete: (id) =>
		otherRequest({
			url: 'order/order/' + id,
			method: 'DELETE',
		}),
	// 售后
	aftersale: {
		// 申请售后
		apply: (data) =>
			otherRequest({
				url: 'order/aftersale',
				method: 'POST',
				data,
			}),
		list: (params) =>
			otherRequest({
				url: 'order/aftersale',
				method: 'GET',
				params,
				custom: {
					showLoading: false,
				},
			}),
		//取消售后
		cancel: (id) =>
			otherRequest({
				url: 'order/aftersale/cancel/' + id,
				method: 'PUT',
			}),
		//删除售后单
		delete: (id) =>
			otherRequest({
				url: 'order/aftersale/' + id,
				method: 'DELETE',
			}),
		// 售后详情
		detail: (id) =>
			otherRequest({
				url: 'order/aftersale/' + id,
				method: 'GET',
			}),
		// 物流公司
		expressCompany: (name) =>
			otherRequest({
				url: 'data/express' + `?name=${name}&list_rows=100`,
				method: 'GET',
			}),
		// 提交退货物流
		submit: (data) =>
			otherRequest({
				url: 'order/aftersale/submit',
				method: 'POST',
				data,
			}),
	},
	//订单包裹
	express: (id, orderId) =>
		request({
			url: 'order/express/' + id + `${orderId ? '/' + orderId : ''}`,
			method: 'GET',
		}),
	// 订单列表
	hotelOrderList: (params) =>
		request({
			url: `hotel/order`,
			method: 'GET',
			params
		}),
	// 订单列表
	hotelOrderList_zwy: (params) =>
		request({
			url: `zowoyoo/order`,
			method: 'GET',
			params
		}),
	// 订单详情
	hotelOrderDetails: (id) =>
		request({
			url: `hotel/order/details/${id}`,
			method: 'GET',
		}),

	hotelOrderDetails_zwy: (id) =>
		request({
			url: `zowoyoo/order/${id}`,
			method: 'GET',
		}),


	hotelOrderTabs: () =>
		request({
			url: `hotel/order/typeList`,
			method: 'GET',
		}),
};